import React from 'react'
import { useLocation, useParams } from 'react-router-dom'
import qs from 'qs'
export default function Music() {
    const location = useLocation()
    const  result = qs.parse(location.search.split('?')[1])
    const musicList = location.state
    const {id} =useParams()


  return (
    <div>
                <p>音乐id{id}</p>
                <p>我的名字是{result.user},我的年龄是{result.age}</p>
    <ul>
    {
                    musicList.map(item=>{
                        return <li key={item.id}>{item.name}</li>
                    })
                }
    </ul>
    </div>
  )
}
